<template>
  <div id="app">
    <el-container class="full-height">
      <!-- 顶部导航栏 -->
      <el-header>
        <el-menu
            mode="horizontal"
            background-color="#006400"
            text-color="#fff"
            active-text-color="#f0f9eb"
        >
          <el-menu-item index="system-title" >学校管理系统</el-menu-item>
          <el-menu-item index="home">首页</el-menu-item>
          <el-menu-item index="about">关于我们</el-menu-item>
          <el-menu-item index="contact">联系我们</el-menu-item>
        </el-menu>
      </el-header>
      <!-- 左侧菜单栏与右侧内容区域 -->
      <el-container class="flex-container">
        <!-- 左侧菜单栏 -->
        <el-aside width="250px" class="fixed-aside">
          <el-menu
              :default-active="activeMenu"
              mode="vertical"
              @select="handleMenuSelect"
              background-color="#e8f5e9"
              text-color="#333"
              active-text-color="#006400"
          >
<!--            用户管理系统-->
            <el-sub-menu index="user">
              <template #title>
                <span>用户管理</span>
              </template>
              <router-link to="user"><el-menu-item index="user-personal" class="sub-menu-item">用户个人信息</el-menu-item></router-link>
            </el-sub-menu>
            <!-- 学生管理系统 -->
            <el-sub-menu index="student">
              <template #title>
                <i class="el-icon-user-solid"></i>
                <span>学生管理</span>
              </template>
              <router-link to="student">
                <el-menu-item index="student-personal" class="sub-menu-item">学生个人信息</el-menu-item>
              </router-link>
              <el-menu-item index="student-academic" class="sub-menu-item">学生学业信息</el-menu-item>
              <el-menu-item index="student-attendance" class="sub-menu-item">学生考勤信息</el-menu-item>
            </el-sub-menu>
            <!-- 课程管理系统 -->
            <el-sub-menu index="course">
              <template #title>
                <i class="el-icon-notebook-2"></i>
                <span>课程管理</span>
              </template>
              <el-menu-item index="course-list" class="sub-menu-item">课程列表</el-menu-item>
              <el-menu-item index="course-schedule" class="sub-menu-item">课程安排</el-menu-item>
              <el-menu-item index="course-enrollment" class="sub-menu-item">课程选课情况</el-menu-item>
            </el-sub-menu>
            <!-- 老师管理系统 -->
            <el-sub-menu index="teacher">
              <template #title>
                <i class="el-icon-user"></i>
                <span>老师管理</span>
              </template>
              <el-menu-item index="teacher-info" class="sub-menu-item">老师个人信息</el-menu-item>
              <el-menu-item index="teacher-teaching" class="sub-menu-item">老师授课信息</el-menu-item>
              <el-menu-item index="teacher-evaluation" class="sub-menu-item">老师评价信息</el-menu-item>
            </el-sub-menu>
            <!-- 教室管理系统 -->
            <el-sub-menu index="classroom">
              <template #title>
                <i class="el-icon-office-building"></i>
                <span>教室管理</span>
              </template>
              <el-menu-item index="classroom-list" class="sub-menu-item">教室列表</el-menu-item>
              <el-menu-item index="classroom-usage" class="sub-menu-item">教室使用情况</el-menu-item>
              <el-menu-item index="classroom-maintenance" class="sub-menu-item">教室维护信息</el-menu-item>
            </el-sub-menu>
          </el-menu>
        </el-aside>
        <!-- 右侧信息显示区域 -->
        <el-main class="main-content">
          <router-view/>
        </el-main>
      </el-container>
      <!-- 底部区域 -->
      <el-footer style="background-color: #006400;">版权所有 &copy; 2024</el-footer>
    </el-container>
  </div>
</template>

<script setup>
import { ref } from 'vue';

// 存储当前激活的菜单索引
const activeMenu = ref('student-personal');

// 处理菜单选择事件
const handleMenuSelect = (index) => {
  activeMenu.value = index;
};
</script>

<style scoped>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin: 0;
  padding: 0;
}

.full-height {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.flex-container {
  flex: 1;
  display: flex;
}

.fixed-aside {
  position: sticky;
  top: 0;
  height: 100%;
  overflow-y: auto;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background-color: #f0f9eb;
}

.sub-menu-item {
  background-color: #c8e6c9;
  color: black;
  text-decoration: none;
}

.el-header {
  line-height: 60px;
  padding: 0;
}

.el-aside {
  text-align: left;
}

.el-footer {
  color: white;
  line-height: 60px;
}


</style>